package com.futureCloudMOM.controller.core.web.wms;

import com.futureCloudMOM.common.annotation.Log;
import com.futureCloudMOM.common.core.domain.AjaxResult;
import com.futureCloudMOM.controller.core.controller.BaseApiController;
import com.futureCloudMOM.core.domain.WmsInventoryMain;
import com.futureCloudMOM.core.domain.WmsInventorySub;
import com.futureCloudMOM.core.dto.WmsInventoryMainDTO;
import com.futureCloudMOM.core.service.WmsInventoryMainService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 文件名 WmsInventoryMainController
 *
 * @since 2023/6/7 9:16
 */
@Api(tags = "盘点主表")
@RestController
@RequestMapping("wms/inventory_main")
public class WmsInventoryMainController extends BaseApiController<WmsInventoryMain, WmsInventoryMain, WmsInventoryMainService> {

    public WmsInventoryMainController(WmsInventoryMainService service) {
        super(service);
    }


    @Log(title = "盘点单新建")
    @ApiOperation("盘点单新建")
    @PostMapping("/created")
    public AjaxResult created(@RequestBody WmsInventoryMainDTO wmsInventoryMainDTO){
        service.created(wmsInventoryMainDTO);
        return success();
    }

    @Log(title = "开始盘点")
    @ApiOperation("开始盘点")
    @GetMapping("/startInventory/{id}")
    public AjaxResult startInventory(@PathVariable("id") Long id){
        service.startInventory(id);
        return success();
    }

    @Log(title = "盘点提交")
    @ApiOperation("盘点提交")
    @PostMapping("/submit")
    public AjaxResult submit(@RequestBody List<WmsInventorySub> list){
        service.submit(list);
        return success();
    }

    @Log(title = "盘点平账")
    @ApiOperation("盘点平账")
    @GetMapping("/account/{id}")
    public AjaxResult account(@PathVariable("id") Long id){

        return success();
    }

}
